package org.bigdata.framework.core.protocol.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.bigdata.framework.core.mapper.CourseMapper;
import org.bigdata.framework.core.mapper.CourseQuestionMapper;
import org.bigdata.framework.core.mapper.LiveQuestionMapper;
import org.bigdata.framework.core.mapper.OnlineQuestionMapper;
import org.bigdata.framework.core.mapper.QuestionDatabaseMapper;
import org.bigdata.framework.core.model.Advertisement;
import org.bigdata.framework.core.model.Answer;
import org.bigdata.framework.core.model.Audit;
import org.bigdata.framework.core.model.Browse;
import org.bigdata.framework.core.model.Category;
import org.bigdata.framework.core.model.ClassesOnline;
import org.bigdata.framework.core.model.ClassesOnlineComment;
import org.bigdata.framework.core.model.Collect;
import org.bigdata.framework.core.model.Comment;
import org.bigdata.framework.core.model.Config;
import org.bigdata.framework.core.model.Course;
import org.bigdata.framework.core.model.CourseComment;
import org.bigdata.framework.core.model.CourseQuestion;
import org.bigdata.framework.core.model.Live;
import org.bigdata.framework.core.model.LiveQuestion;
import org.bigdata.framework.core.model.Log;
import org.bigdata.framework.core.model.Member;
import org.bigdata.framework.core.model.Menu;
import org.bigdata.framework.core.model.Message;
import org.bigdata.framework.core.model.Online;
import org.bigdata.framework.core.model.OnlineQuestion;
import org.bigdata.framework.core.model.Order;
import org.bigdata.framework.core.model.Paper;
import org.bigdata.framework.core.model.Permission;
import org.bigdata.framework.core.model.Question;
import org.bigdata.framework.core.model.QuestionDatabase;
import org.bigdata.framework.core.model.Role;
import org.bigdata.framework.core.model.ShortFilm;
import org.bigdata.framework.core.model.ShortFilmComment;
import org.bigdata.framework.core.model.User;
import org.bigdata.framework.core.model.UserRole;
import org.bigdata.framework.core.protocol.IPublicService;
import org.bigdata.framework.core.service.IAdvertisementService;
import org.bigdata.framework.core.service.IAnswerService;
import org.bigdata.framework.core.service.IAuditService;
import org.bigdata.framework.core.service.IBrowseService;
import org.bigdata.framework.core.service.ICategoryService;
import org.bigdata.framework.core.service.IClassesOnlineCommentService;
import org.bigdata.framework.core.service.IClassesOnlineService;
import org.bigdata.framework.core.service.ICollectService;
import org.bigdata.framework.core.service.ICommentService;
import org.bigdata.framework.core.service.IConfigService;
import org.bigdata.framework.core.service.ICourseCommentService;
import org.bigdata.framework.core.service.ICourseQuestionService;
import org.bigdata.framework.core.service.ICourseService;
import org.bigdata.framework.core.service.ILiveQuestionService;
import org.bigdata.framework.core.service.ILiveService;
import org.bigdata.framework.core.service.ILogService;
import org.bigdata.framework.core.service.IMemberService;
import org.bigdata.framework.core.service.IMenuService;
import org.bigdata.framework.core.service.IMessageService;
import org.bigdata.framework.core.service.IOnlineQuestionService;
import org.bigdata.framework.core.service.IOnlineService;
import org.bigdata.framework.core.service.IOrderService;
import org.bigdata.framework.core.service.IPaperService;
import org.bigdata.framework.core.service.IPermissionService;
import org.bigdata.framework.core.service.IQuestionDatabaseService;
import org.bigdata.framework.core.service.IQuestionService;
import org.bigdata.framework.core.service.IRoleService;
import org.bigdata.framework.core.service.IShortFilmCommentService;
import org.bigdata.framework.core.service.IShortFilmService;
import org.bigdata.framework.core.service.IUserRoleService;
import org.bigdata.framework.core.service.IUserService;
import org.bigdata.framework.core.utils.MybatisPlusTools;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.plugins.Page;

/**
 * 2016-8-30 13:54:42
 * 
 * @author vimes
 * 
 */
@Service
public class PublicService implements IPublicService {

	@Autowired
	private IUserService userService;
	@Autowired
	private IUserRoleService userRoleService;
	@Autowired
	private IRoleService roleService;
	@Autowired
	private IMenuService menuService;
	@Autowired
	private IPermissionService permissionService;
	@Autowired
	private IAdvertisementService advertisementService;
	@Autowired
	private IBrowseService browseService;
	@Autowired
	private ICategoryService categoryService;
	@Autowired
	private IClassesOnlineService classesOnlineService;
	@Autowired
	private IClassesOnlineCommentService classesOnlineCommentService;
	@Autowired
	private ICollectService collectService;
	@Autowired
	private ICommentService commentService;
	@Autowired
	private IConfigService configService;
	@Autowired
	private ICourseService courseService;
	@Autowired
	private ICourseQuestionService courseQuestionService;
	@Autowired
	private ICourseCommentService courseCommentService;
	@Autowired
	private ILiveService liveService;
	@Autowired
	private ILiveQuestionService liveQuestionService;
	@Autowired
	private ILogService logService;
	@Autowired
	private IMemberService memberService;
	@Autowired
	private IMessageService messageService;
	@Autowired
	private IOnlineService onlineService;
	@Autowired
	private IOnlineQuestionService onlineQuestionService;
	@Autowired
	private IOrderService orderService;
	@Autowired
	private IQuestionService questionService;
	@Autowired
	private IQuestionDatabaseService questionDatabaseService;
	@Autowired
	private IShortFilmService shortFilmService;
	@Autowired
	private IShortFilmCommentService shortFilmCommentService;
	@Autowired
	private IPaperService paperService;
	@Autowired
	private IAnswerService answerService;
	@Autowired
	private CourseQuestionMapper courseQuestionMapper;
	@Autowired
	private LiveQuestionMapper liveQuestionMapper;
	@Autowired
	private OnlineQuestionMapper onlineQuestionMapper;
	@Autowired
	private QuestionDatabaseMapper questionDatabaseMapper;
	@Autowired
	private IAuditService auditService;
	
	
	@Override
	public User findUser(Integer id) {
		return userService.selectById(id);
	}

	@Override
	public List<User> getUser() {
		HashMap<String, Object> queryParams = new HashMap<String, Object>();
		queryParams.put("^,create_time", "desc");
		return userService.selectList(new MybatisPlusTools<User>()
				.getEwByList(queryParams));
	}

	@Override
	public List<User> getUser(HashMap<String, Object> queryParams,
			int pageNumber, int pageSize) {
		if(queryParams==null || "".equals(queryParams)){
			queryParams.put("^,create_time", "desc");
		}
		return userService.selectPage(new Page<User>(pageNumber, pageSize),
				new MybatisPlusTools<User>().getEwByList(queryParams))
				.getRecords();
	}

	@Override
	public Integer getUserCount(HashMap<String, Object> queryParams) {

		return userService.selectCount(new MybatisPlusTools<User>()
				.getEwByCount(queryParams));
	}

	

	@Override
	public Menu findMenu(Integer id) {

		return menuService.selectById(id);
	}

	@Override
	public List<Menu> getMenu() {
		HashMap<String, Object> queryParams = new HashMap<String, Object>();
		queryParams.put("^,sort", "asc");
		return menuService.selectList(new MybatisPlusTools<Menu>()
				.getEwByList(queryParams));
	}

	

	@Override
	public Permission findPermission(Integer id) {

		return permissionService.selectById(id);
	}

	@Override
	public List<Permission> getPermission() {
		return permissionService.selectList(null);
	}

	@Override
	public List<Permission> getPermission(HashMap<String, Object> queryParams) {

		return permissionService.selectPage(
				new Page<Permission>(1, Integer.MAX_VALUE),
				new MybatisPlusTools<Permission>().getEwByList(queryParams))
				.getRecords();
	}

	

	@Override
	public Role findRole(Integer id) {

		return roleService.selectById(id);
	}

	@Override
	public List<Role> getRole() {
		return roleService.selectList(null);
	}

	@Override
	public List<Role> getRole(HashMap<String, Object> queryParams) {

		return roleService.selectPage(new Page<Role>(1, Integer.MAX_VALUE),
				new MybatisPlusTools<Role>().getEwByList(queryParams))
				.getRecords();
	}

	
	@Override
	public UserRole findUserRole(Integer id) {

		return userRoleService.selectById(id);
	}

	@Override
	public List<UserRole> getUserRole() {
		return userRoleService.selectList(null);
	}

	@Override
	public List<UserRole> getUserRole(HashMap<String, Object> queryParams) {
		return userRoleService.selectPage(
				new Page<UserRole>(1, Integer.MAX_VALUE),
				new MybatisPlusTools<UserRole>().getEwByList(queryParams))
				.getRecords();
	}

	@Override
	public Advertisement findAdvertisement(Integer id) {
		return advertisementService.selectById(id);
	}

	@Override
	public List<Advertisement> getAdvertisement(HashMap<String, Object> queryParams, int pageNumber, int pageSize) {
		if(queryParams==null || "".equals(queryParams)){
			queryParams.put("^,id", "desc");
		}
		return advertisementService.selectPage(new Page<Advertisement>(pageNumber, pageSize),
				new MybatisPlusTools<Advertisement>().getEwByList(queryParams))
				.getRecords();
	}

	@Override
	public Integer getAdvertisementCount(HashMap<String, Object> queryParams) {
		return advertisementService.selectCount(new MybatisPlusTools<Advertisement>()
				.getEwByCount(queryParams));
	}

	@Override
	public Browse findBrowse(Integer id) {
		return browseService.selectById(id);
	}

	@Override
	public List<Browse> getBrowse(HashMap<String, Object> queryParams, int pageNumber, int pageSize) {
		if(queryParams==null || "".equals(queryParams)){
			queryParams.put("^,id", "desc");
		}
		return browseService.selectPage(new Page<Browse>(pageNumber, pageSize),
				new MybatisPlusTools<Browse>().getEwByList(queryParams))
				.getRecords();
	}

	@Override
	public Integer getBrowseCount(HashMap<String, Object> queryParams) {
		return browseService.selectCount(new MybatisPlusTools<Browse>()
				.getEwByCount(queryParams));
	}

	@Override
	public Category findCategory(Integer id) {
		return categoryService.selectById(id);
	}


	@Override
	public List<Category> getCategory() {
		HashMap<String, Object> queryParams = new HashMap<String, Object>();
		queryParams.put("^,sort", "asc");
		return categoryService.selectList(new MybatisPlusTools<Category>()
				.getEwByList(queryParams));
	}
	
	@Override
	public List<Category> getCategory(HashMap<String, Object> queryParams, int pageNumber, int pageSize) {
		if(queryParams==null || "".equals(queryParams)){
			queryParams.put("^,id", "desc");
		}
		return categoryService.selectPage(new Page<Category>(pageNumber, pageSize),
				new MybatisPlusTools<Category>().getEwByList(queryParams))
				.getRecords();
	}

	@Override
	public Integer getCategoryCount(HashMap<String, Object> queryParams) {
		return categoryService.selectCount(new MybatisPlusTools<Category>()
				.getEwByCount(queryParams));
	}

	@Override
	public ClassesOnline findClassesOnline(Integer id) {
		return classesOnlineService.selectById(id);
	}

	@Override
	public List<ClassesOnline> getClassesOnline(HashMap<String, Object> queryParams, int pageNumber, int pageSize) {
		if(queryParams==null || "".equals(queryParams)){
			queryParams.put("^,id", "desc");
		}
		return classesOnlineService.selectPage(new Page<ClassesOnline>(pageNumber, pageSize),
				new MybatisPlusTools<ClassesOnline>().getEwByList(queryParams))
				.getRecords();
	}

	@Override
	public Integer getClassesOnlineCount(HashMap<String, Object> queryParams) {
		return classesOnlineService.selectCount(new MybatisPlusTools<ClassesOnline>()
				.getEwByCount(queryParams));
	}

	@Override
	public ClassesOnlineComment findClassesOnlineComment(Integer id) {
		return classesOnlineCommentService.selectById(id);
	}

	@Override
	public List<ClassesOnlineComment> getClassesOnlineComment(HashMap<String, Object> queryParams, int pageNumber,
			int pageSize) {
		if(queryParams==null || "".equals(queryParams)){
			queryParams.put("^,id", "desc");
		}
		return classesOnlineCommentService.selectPage(new Page<ClassesOnlineComment>(pageNumber, pageSize),
				new MybatisPlusTools<ClassesOnlineComment>().getEwByList(queryParams))
				.getRecords();
	}

	@Override
	public Integer getClassesOnlineCommentCount(HashMap<String, Object> queryParams) {
		return classesOnlineCommentService.selectCount(new MybatisPlusTools<ClassesOnlineComment>()
				.getEwByCount(queryParams));
	}

	@Override
	public Collect findCollect(Integer id) {
		return collectService.selectById(id);
	}

	@Override
	public List<Collect> getCollect(HashMap<String, Object> queryParams, int pageNumber, int pageSize) {
		if(queryParams==null || "".equals(queryParams)){
			queryParams.put("^,id", "desc");
		}
		return collectService.selectPage(new Page<Collect>(pageNumber, pageSize),
				new MybatisPlusTools<Collect>().getEwByList(queryParams))
				.getRecords();
	}

	@Override
	public Integer getCollectCount(HashMap<String, Object> queryParams) {
		return collectService.selectCount(new MybatisPlusTools<Collect>()
				.getEwByCount(queryParams));
	}

	@Override
	public Comment findComment(Integer id) {
		return commentService.selectById(id);
	}

	@Override
	public List<Comment> getComment(HashMap<String, Object> queryParams, int pageNumber, int pageSize) {
		if(queryParams==null || "".equals(queryParams)){
			queryParams.put("^,id", "desc");
		}
		return commentService.selectPage(new Page<Comment>(pageNumber, pageSize),
				new MybatisPlusTools<Comment>().getEwByList(queryParams))
				.getRecords();
	}

	@Override
	public Integer getCommentCount(HashMap<String, Object> queryParams) {
		return commentService.selectCount(new MybatisPlusTools<Comment>()
				.getEwByCount(queryParams));
	}

	@Override
	public Config findConfig(Integer id) {
		return configService.selectById(id);
	}

	@Override
	public List<Config> getConfig(HashMap<String, Object> queryParams, int pageNumber, int pageSize) {
		if(queryParams==null || "".equals(queryParams)){
			queryParams.put("^,id", "desc");
		}
		return configService.selectPage(new Page<Config>(pageNumber, pageSize),
				new MybatisPlusTools<Config>().getEwByList(queryParams))
				.getRecords();
	}

	@Override
	public Integer getConfigCount(HashMap<String, Object> queryParams) {
		return configService.selectCount(new MybatisPlusTools<Config>()
				.getEwByCount(queryParams));
	}

	@Override
	public Course findCourse(Integer id) {
		return courseService.selectById(id);
	}

	@Override
	public List<Course> getCourse(HashMap<String, Object> queryParams, int pageNumber, int pageSize) {
		if(queryParams==null || "".equals(queryParams)){
			queryParams.put("^,id", "desc");
		}
		return courseService.selectPage(new Page<Course>(pageNumber, pageSize),
				new MybatisPlusTools<Course>().getEwByList(queryParams))
				.getRecords();
	}

	@Override
	public Integer getCourseCount(HashMap<String, Object> queryParams) {
		return courseService.selectCount(new MybatisPlusTools<Course>()
				.getEwByCount(queryParams));
	}

	@Override
	public CourseComment findCourseComment(Integer id) {
		return courseCommentService.selectById(id);
	}

	@Override
	public List<CourseComment> getCourseComment(HashMap<String, Object> queryParams, int pageNumber, int pageSize) {
		if(queryParams==null || "".equals(queryParams)){
			queryParams.put("^,id", "desc");
		}
		return courseCommentService.selectPage(new Page<CourseComment>(pageNumber, pageSize),
				new MybatisPlusTools<CourseComment>().getEwByList(queryParams))
				.getRecords();
	}

	@Override
	public Integer getCourseCommentCount(HashMap<String, Object> queryParams) {
		return courseCommentService.selectCount(new MybatisPlusTools<CourseComment>()
				.getEwByCount(queryParams));
	}

	@Override
	public CourseQuestion findCourseQuestion(Integer id) {
		return courseQuestionService.selectById(id);
	}

	@Override
	public List<CourseQuestion> getCourseQuestion(HashMap<String, Object> queryParams, int pageNumber, int pageSize) {
		if(queryParams==null || "".equals(queryParams)){
			queryParams.put("^,id", "desc");
		}
		return courseQuestionService.selectPage(new Page<CourseQuestion>(pageNumber, pageSize),
				new MybatisPlusTools<CourseQuestion>().getEwByList(queryParams))
				.getRecords();
	}

	@Override
	public Integer getCourseQuestionCount(HashMap<String, Object> queryParams) {
		return courseQuestionService.selectCount(new MybatisPlusTools<CourseQuestion>()
				.getEwByCount(queryParams));
	}

	@Override
	public Live findLive(Integer id) {
		return liveService.selectById(id);
	}

	@Override
	public List<Live> getLive(HashMap<String, Object> queryParams, int pageNumber, int pageSize) {
		if(queryParams==null || "".equals(queryParams)){
			queryParams.put("^,id", "desc");
		}
		return liveService.selectPage(new Page<Live>(pageNumber, pageSize),
				new MybatisPlusTools<Live>().getEwByList(queryParams))
				.getRecords();
	}

	@Override
	public Integer getLiveCount(HashMap<String, Object> queryParams) {
		return liveService.selectCount(new MybatisPlusTools<Live>()
				.getEwByCount(queryParams));
	}

	@Override
	public LiveQuestion findLiveQuestion(Integer id) {
		return liveQuestionService.selectById(id);
	}

	@Override
	public List<LiveQuestion> getLiveQuestion(HashMap<String, Object> queryParams, int pageNumber, int pageSize) {
		if(queryParams==null || "".equals(queryParams)){
			queryParams.put("^,id", "desc");
		}
		return liveQuestionService.selectPage(new Page<LiveQuestion>(pageNumber, pageSize),
				new MybatisPlusTools<LiveQuestion>().getEwByList(queryParams))
				.getRecords();
	}

	@Override
	public Integer getLiveQuestionCount(HashMap<String, Object> queryParams) {
		return liveQuestionService.selectCount(new MybatisPlusTools<LiveQuestion>()
				.getEwByCount(queryParams));
	}

	@Override
	public Log findLog(Integer id) {
		return logService.selectById(id);
	}

	@Override
	public List<Log> getLog(HashMap<String, Object> queryParams, int pageNumber, int pageSize) {
		if(queryParams==null || "".equals(queryParams)){
			queryParams.put("^,id", "desc");
		}
		return logService.selectPage(new Page<Log>(pageNumber, pageSize),
				new MybatisPlusTools<Log>().getEwByList(queryParams))
				.getRecords();
	}

	@Override
	public Integer getLogCount(HashMap<String, Object> queryParams) {
		return logService.selectCount(new MybatisPlusTools<Log>()
				.getEwByCount(queryParams));
	}

	@Override
	public Member findMember(Integer id) {
		return memberService.selectById(id);
	}

	@Override
	public List<Member> getMember(HashMap<String, Object> queryParams, int pageNumber, int pageSize) {
		if(queryParams==null || "".equals(queryParams)){
			queryParams.put("^,id", "desc");
		}
		return memberService.selectPage(new Page<Member>(pageNumber, pageSize),
				new MybatisPlusTools<Member>().getEwByList(queryParams))
				.getRecords();
	}

	@Override
	public Integer getMemberCount(HashMap<String, Object> queryParams) {
		return memberService.selectCount(new MybatisPlusTools<Member>()
				.getEwByCount(queryParams));
	}

	@Override
	public Message findMessage(Integer id) {
		return messageService.selectById(id);
	}

	@Override
	public List<Message> getMessage(HashMap<String, Object> queryParams, int pageNumber, int pageSize) {
		if(queryParams==null || "".equals(queryParams)){
			queryParams.put("^,id", "desc");
		}
		return messageService.selectPage(new Page<Message>(pageNumber, pageSize),
				new MybatisPlusTools<Message>().getEwByList(queryParams))
				.getRecords();
	}

	@Override
	public Integer getMessageCount(HashMap<String, Object> queryParams) {
		return messageService.selectCount(new MybatisPlusTools<Message>()
				.getEwByCount(queryParams));
	}

	@Override
	public Online findOnline(Integer id) {
		return onlineService.selectById(id);
	}

	@Override
	public List<Online> getOnline(HashMap<String, Object> queryParams, int pageNumber, int pageSize) {
		if(queryParams==null || "".equals(queryParams)){
			queryParams.put("^,id", "desc");
		}
		return onlineService.selectPage(new Page<Online>(pageNumber, pageSize),
				new MybatisPlusTools<Online>().getEwByList(queryParams))
				.getRecords();
	}

	@Override
	public Integer getOnlineCount(HashMap<String, Object> queryParams) {
		return onlineService.selectCount(new MybatisPlusTools<Online>()
				.getEwByCount(queryParams));
	}

	@Override
	public OnlineQuestion findOnlineQuestion(Integer id) {
		return onlineQuestionService.selectById(id);
	}

	@Override
	public List<OnlineQuestion> getOnlineQuestion(HashMap<String, Object> queryParams, int pageNumber, int pageSize) {
		if(queryParams==null || "".equals(queryParams)){
			queryParams.put("^,id", "desc");
		}
		return onlineQuestionService.selectPage(new Page<OnlineQuestion>(pageNumber, pageSize),
				new MybatisPlusTools<OnlineQuestion>().getEwByList(queryParams))
				.getRecords();
	}

	@Override
	public Integer getOnlineQuestionCount(HashMap<String, Object> queryParams) {
		return onlineQuestionService.selectCount(new MybatisPlusTools<OnlineQuestion>()
				.getEwByCount(queryParams));
	}

	@Override
	public Order findOrder(Integer id) {
		return orderService.selectById(id);
	}

	@Override
	public List<Order> getOrder(HashMap<String, Object> queryParams, int pageNumber, int pageSize) {
		if(queryParams==null || "".equals(queryParams)){
			queryParams.put("^,id", "desc");
		}
		return orderService.selectPage(new Page<Order>(pageNumber, pageSize),
				new MybatisPlusTools<Order>().getEwByList(queryParams))
				.getRecords();
	}

	@Override
	public Integer getOrderCount(HashMap<String, Object> queryParams) {
		return orderService.selectCount(new MybatisPlusTools<Order>()
				.getEwByCount(queryParams));
	}

	@Override
	public Question findQuestion(Integer id) {
		return questionService.selectById(id);
	}

	@Override
	public List<Question> getQuestion(HashMap<String, Object> queryParams, int pageNumber, int pageSize) {
		if(queryParams==null || "".equals(queryParams)){
			queryParams.put("^,id", "desc");
		}
		return questionService.selectPage(new Page<Question>(pageNumber, pageSize),
				new MybatisPlusTools<Question>().getEwByList(queryParams))
				.getRecords();
	}

	@Override
	public Integer getQuestionCount(HashMap<String, Object> queryParams) {
		return questionService.selectCount(new MybatisPlusTools<Question>()
				.getEwByCount(queryParams));
	}

	@Override
	public QuestionDatabase findQuestionDatabase(Integer id) {
		return questionDatabaseService.selectById(id);
	}

	@Override
	public List<QuestionDatabase> getQuestionDatabase(HashMap<String, Object> queryParams, int pageNumber,
			int pageSize) {
		if(queryParams==null || "".equals(queryParams)){
			queryParams.put("^,id", "desc");
		}
		return questionDatabaseService.selectPage(new Page<QuestionDatabase>(pageNumber, pageSize),
				new MybatisPlusTools<QuestionDatabase>().getEwByList(queryParams))
				.getRecords();
	}

	@Override
	public Integer getQuestionDatabaseCount(HashMap<String, Object> queryParams) {
		return questionDatabaseService.selectCount(new MybatisPlusTools<QuestionDatabase>()
				.getEwByCount(queryParams));
	}

	@Override
	public ShortFilm findShortFilm(Integer id) {
		return shortFilmService.selectById(id);
	}

	@Override
	public List<ShortFilm> getShortFilm(HashMap<String, Object> queryParams, int pageNumber, int pageSize) {
		if(queryParams==null || "".equals(queryParams)){
			queryParams.put("^,id", "desc");
		}
		return shortFilmService.selectPage(new Page<ShortFilm>(pageNumber, pageSize),
				new MybatisPlusTools<ShortFilm>().getEwByList(queryParams))
				.getRecords();
	}

	@Override
	public Integer getShortFilmCount(HashMap<String, Object> queryParams) {
		return shortFilmService.selectCount(new MybatisPlusTools<ShortFilm>()
				.getEwByCount(queryParams));
	}

	@Override
	public ShortFilmComment findShortFilmComment(Integer id) {
		return shortFilmCommentService.selectById(id);
	}

	@Override
	public List<ShortFilmComment> getShortFilmComment(HashMap<String, Object> queryParams, int pageNumber,
			int pageSize) {
		if(queryParams==null || "".equals(queryParams)){
			queryParams.put("^,id", "desc");
		}
		return shortFilmCommentService.selectPage(new Page<ShortFilmComment>(pageNumber, pageSize),
				new MybatisPlusTools<ShortFilmComment>().getEwByList(queryParams))
				.getRecords();
	}

	@Override
	public Integer getShortFilmCommentCount(HashMap<String, Object> queryParams) {
		return shortFilmCommentService.selectCount(new MybatisPlusTools<ShortFilmComment>()
				.getEwByCount(queryParams));
	}

	@Override
	public Paper findPaper(Integer id) {
		return paperService.selectById(id);
	}

	@Override
	public List<Paper> getPaper(HashMap<String, Object> queryParams, int pageNumber, int pageSize) {
		if(queryParams==null || "".equals(queryParams)){
			queryParams.put("^,id", "desc");
		}
		return paperService.selectPage(new Page<Paper>(pageNumber, pageSize),
				new MybatisPlusTools<Paper>().getEwByList(queryParams))
				.getRecords();
	}

	@Override
	public Integer getPaperCount(HashMap<String, Object> queryParams) {
		return paperService.selectCount(new MybatisPlusTools<Paper>()
				.getEwByCount(queryParams));
	}

	@Override
	public Answer findAnswer(Integer id) {
		return answerService.selectById(id);
	}

	@Override
	public List<Answer> getAnswer(HashMap<String, Object> queryParams, int pageNumber, int pageSize) {
		if(queryParams==null || "".equals(queryParams)){
			queryParams.put("^,id", "desc");
		}
		return answerService.selectPage(new Page<Answer>(pageNumber, pageSize),
				new MybatisPlusTools<Answer>().getEwByList(queryParams))
				.getRecords();
	}

	@Override
	public Integer getAnswerCount(HashMap<String, Object> queryParams) {
		return answerService.selectCount(new MybatisPlusTools<Answer>()
				.getEwByCount(queryParams));
	}

	
	@Override
	public List<Map<String, Object>> getCourseQuestionList(String id, int pageNumber,int pageSize) {
		Page<Map<String,Object>> page = new Page<Map<String,Object>>(pageNumber, pageSize);
		return courseQuestionMapper.getCourseQuestionList(page, id);
	}

	@Override
	public Integer getCourseQuestionListCount(String id) {
		return courseQuestionMapper.getCourseQuestionListCount(id);
	}
	@Override
	public List<Map<String, Object>> getLiveQuestionList(String id, int pageNumber,int pageSize) {
		Page<Map<String,Object>> page = new Page<Map<String,Object>>(pageNumber, pageSize);
		return liveQuestionMapper.getLiveQuestionList(page, id);
	}
	
	@Override
	public Integer getLiveQuestionListCount(String id) {
		return liveQuestionMapper.getLiveQuestionListCount(id);
	}
	@Override
	public List<Map<String, Object>> getOnlineQuestionList(String id, int pageNumber,int pageSize) {
		Page<Map<String,Object>> page = new Page<Map<String,Object>>(pageNumber, pageSize);
		return onlineQuestionMapper.getOnlineQuestionList(page, id);
	}
	
	@Override
	public Integer getOnlineQuestionListCount(String id) {
		return onlineQuestionMapper.getOnlineQuestionListCount(id);
	}

	@Override
	public Audit findAudit(Integer id) {
		return auditService.selectById(id);
	}

	@Override
	public List<Audit> getAudit(HashMap<String, Object> queryParams, int pageNumber, int pageSize) {
		if(queryParams==null || "".equals(queryParams)){
			queryParams.put("^,id", "desc");
		}
		return auditService.selectPage(new Page<Audit>(pageNumber, pageSize),
				new MybatisPlusTools<Audit>().getEwByList(queryParams))
				.getRecords();
	}

	@Override
	public Integer getAuditCount(HashMap<String, Object> queryParams) {
		return auditService.selectCount(new MybatisPlusTools<Audit>()
				.getEwByCount(queryParams));
	}

	@Override
	public Integer courseOrderQuetionBaseCount(String id) {
		return questionDatabaseMapper.courseOrderQuetionBaseCount(id);
	}

	@Override
	public Integer onlineOrderQuetionBaseCount(String id) {
		return questionDatabaseMapper.onlineOrderQuetionBaseCount(id);
	}

}
